/*
 * @Author: TT-hzy 
 * @Date: 2024-05-05 17:23:45
 * @LastEditors: TT-hzy 
 * @LastEditTime: 2024-05-05 17:23:46
 * @Description: 
 */

import 'package:flutter/material.dart';

class AppRouterObserver {
  //这是实际上的路由监听器
  static final RouteObserver<ModalRoute<void>> _routeObserver =
      RouteObserver<ModalRoute<void>>();
  //这是个单例
  static final AppRouterObserver _appRouteObserver =
      AppRouterObserver._internal();

  AppRouterObserver._internal();
  //通过单例的get方法轻松获取路由监听器
  RouteObserver<ModalRoute<void>> get routeObserver {
    return _routeObserver;
  }

  factory AppRouterObserver() {
    return _appRouteObserver;
  }
}
